package com.example.java_gobang.tests;

import com.example.java_gobang.common.BrowserName;
import com.example.java_gobang.common.Utils;
import lombok.SneakyThrows;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

/**
 * @author hanzishuai
 * Blog :  https://blog.csdn.net/qrwitu142857
 * @date 2025/5/11 22:28
 * @Description
 */
public class GameHallPage extends Utils {
    public static final String url = "http://101.201.246.67:58080/game_hall.html";

    public GameHallPage() {
        super(url);
    }

    public GameHallPage(BrowserName browserName) {
        super(url, browserName);
    }

    @SneakyThrows
    public void checkGameHallPageRight() {
        driver.findElement(By.cssSelector("#screen"));
        driver.findElement(By.cssSelector("#match-button"));
        screenShot("checkGameHallPageRight");
    }

    @SneakyThrows
    public void startMatch() {
        WebElement button = driver.findElement(By.cssSelector("#match-button"));
        button.click();
        String text = button.getText();
        assert "匹配中...(点击停止)".equals(text);
        screenShot("startMatch");
    }


    @SneakyThrows
    public void stopMatch() {
        WebElement button = driver.findElement(By.cssSelector("#match-button"));
        button.click();
        String text = button.getText();
        assert "开始匹配".equals(text);
        screenShot("stopMatch");
    }



}
